//帮助创建action
import axios from 'axios';
import * as constants from './constants';

const changMenuData = (result) => ({
    type: constants.MENU_LIST,
    menuList: result.menuList
});

export const dhOut = () => ({
    type: constants.ONCLICK_OUT,
    show: false
});

export const  getMenu = () => {
    return (dispatch) => {
        axios.get('/api/menu.json').then((res) => {
            const result = res.data;
            dispatch(changMenuData(result));
        })
    }
};

